Skip to content

feat: expose branch clean configuration via environment variables - #338

Open
mefellows wants to merge 1 commit into
masterfrom
feat/branch-clean-env-vars
Open

feat: expose branch clean configuration via environment variables#338
mefellows wants to merge 1 commit into
masterfrom
feat/branch-clean-env-vars

Conversation

@mefellows

Copy link
Copy Markdown
Member

Summary

Wires in environment variables for the stale branch cleanup feature introduced in pact-foundation/pact_broker#912 and pact-foundation/pact_broker#933, and documents them in the README.

New environment variables

  • PACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS — JSON array of selectors controlling which branches are kept. Each selector supports max_age (days) and/or branch (name or array of names). The pacticipant's main_branch is always kept regardless. Defaults to [{"max_age": 90}]. Set to [] to disable stale branch cleanup entirely.
  • PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT — Maximum number of stale branches to delete per clean run. Defaults to PACT_BROKER_DATABASE_CLEAN_DELETION_LIMIT.

Changes

  • pact_broker/Rakefile — reads both env vars and forwards them to CleanTask
  • README.md — documents both vars in the existing database clean section

⚠️ Dependency

PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT requires pact-foundation/pact_broker#938 to be merged and released before it has any effect at runtime. That PR adds branch_deletion_limit to CleanTask and forwards it to CleanIncremental. The env var is safe to ship now — it will silently have no effect until the gem is updated.

Test plan

  • Run docker compose -f docker-compose-clean.yml up locally and confirm clean task runs without errors
  • Set PACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS='[{"max_age":30}]' and confirm it is applied
  • Confirm README renders correctly

🤖 Generated with Claude Code

Wires in three new environment variables for the stale branch cleanup
feature introduced in pact-foundation/pact_broker#912 and #933:

- PACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS
- PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT

Also documents both vars in README alongside the existing clean settings.

Note: PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT requires
pact-foundation/pact_broker#938 to be merged and released before it
has any effect at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mefellows

Copy link
Copy Markdown
Member Author

This is good to merge when the next Pact Broker release goes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants